<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单修饰符</title>
</head>
<body>
<div id="app">
    <!--number 将字符串转化为数值-->
    <input type="text" v-model.number.trim="age"><br>
    <!--trim 去除空格-->
    <input type="text" v-model.trim="message"><br>
    <!--lazy 将input切换为change事件-->
    <input type="text" v-model.lazy="msg"><br>
    {{msg}}
    <br>
    <button @click="handle">点击</button>
</div>

<!-- 生产环境版本，优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
    /*
      表单修饰符
    */
    var vue = new Vue({
        el: "#app",
        data: {
            age: "1",
            message: "",
            msg: ""
        },
        methods: {
            handle: function () {
                this.age++;
                console.log(this.message.length)
            }
        }
    })
</script>
</body>
</html>
